home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2003 March / DPPCPRO0303.ISO / Components / Microsoft ASP / _SETUP.1 / ASPWizard.jar / asp / wizard / AspWizard.class (.txt) next >
Encoding:
Java Class File  |  1998-11-20  |  3.3 KB  |  82 lines

  1. package asp.wizard;
  2.  
  3. import asp.netobjects.nfx.wizard.Wizard;
  4. import asp.util.EResourceUtil;
  5. import asp.util.ResourceUtil;
  6. import asp.wizard.util.NfxUtil;
  7. import asp.wizard.util.UiUtil;
  8. import com.netobjects.nfc.api.ApplicationComp;
  9. import com.netobjects.nfc.api.DNode;
  10. import com.netobjects.nfc.api.DSiteView;
  11. import com.sun.java.swing.JFrame;
  12. import com.sun.java.swing.UIManager;
  13. import java.awt.Component;
  14. import java.awt.Container;
  15. import java.awt.Dialog;
  16.  
  17. public class AspWizard extends ApplicationComp {
  18.    private static final String MSG_STATUS_CHECKINGCOMP = "msg.checkingcomp";
  19.    private static final String MSG_STATUS_INITWIZWIN = "msg.initwizwindow";
  20.    private static final String MSG_STATUS_PRELOADCLASS = "msg.preloadclasses";
  21.    private static final String MSG_STATUS_INITWIZINTERNAL = "msg.initwizinternal";
  22.    private static final String TITLE_LOADING_WIS = "title.loadingwiz";
  23.  
  24.    public void onEnable(DSiteView dsv) {
  25.       String origLaf = UIManager.getLookAndFeel().getClass().getName();
  26.       ResourceUtil ru = null;
  27.       AspWizardExceptionHandler aweh = new AspWizardExceptionHandler((Container)null);
  28.       ProgressStatus ps = null;
  29.  
  30.       try {
  31.          UiUtil.lafSetup();
  32.  
  33.          try {
  34.             ru = ResourceUtil.getResourceUtil("asp.wizard.res", this.getClass());
  35.          } catch (EResourceUtil e) {
  36.             aweh.handleException(e);
  37.             return;
  38.          }
  39.  
  40.          ps = ProgressStatus.getInstance();
  41.          ((Dialog)ps).setTitle(ru.getString("title.loadingwiz"));
  42.          ps.reset();
  43.          ((Component)ps).setVisible(true);
  44.          ps.setText(ru.getString("msg.checkingcomp"));
  45.          DNode currentNode = new DNode();
  46.          if (NfxUtil.componentsInstalled(currentNode)) {
  47.             ps.setValue(30);
  48.             ps.setText(ru.getString("msg.initwizwindow"));
  49.             JFrame f = WizardManager.createMainFrame();
  50.             ps.setValue(50);
  51.             ps.setText(ru.getString("msg.preloadclasses"));
  52.  
  53.             try {
  54.                Class.forName("asp.wizard.util.OdbcDsnRetriever");
  55.             } catch (ClassNotFoundException e) {
  56.                aweh.handleException(e);
  57.                return;
  58.             }
  59.  
  60.             ps.setValue(80);
  61.             ps.setText(ru.getString("msg.initwizinternal"));
  62.             WizardManager wm = new WizardManager(f, (String)null, (String)null, 540, 400, new AspWizardExceptionHandler(f));
  63.             wm.setDSiteView(dsv);
  64.             ps.setValue(100);
  65.             ((Component)ps).setVisible(false);
  66.             ((Dialog)ps).setTitle("");
  67.             ((Wizard)wm).setVisible(true);
  68.             if (wm.isFinished()) {
  69.                wm.processDefPages();
  70.             }
  71.  
  72.          }
  73.       } finally {
  74.          if (ps != null && ((Component)ps).isVisible()) {
  75.             ((Component)ps).setVisible(false);
  76.          }
  77.  
  78.          UiUtil.lafRestore();
  79.       }
  80.    }
  81. }
  82.